
const template = 
`
<div>
      <span>这里可能是很复杂的逻辑</span>
      <span>xxxxxxxxxx</span>
        <bForm ref="form" bill-root-name="name1" :model="marketing" label-position="right" :rules="ruleValidate" :label-width="110" >
        <field field-meta-id='marketing-date' field-meta-deleted='true' field-label="开始日期" field-prop="startTime" :field-disabled="dateValidateDisabled" style="width:100%" type="date" placeholder="点击选择日期" v-model="marketing.startTime" :options="optionsStartDate" col-span="12"></field>
        <field field-meta-id='marketing-type' type="dict" field-label="活动类型" validate-rules="[
            { 
                validator: validateName,
                trigger: 'blur' ,
                type: 'string',
                required : true
            },
            {
                max : 100,
                trigger: 'blur',
                message: '输入字数长度超过100'
            }
        ]" field-prop="type" :dictName="'com.beecode.inz.crm.dict.MarketingTypeDict'" :dictType="'list'" v-model="marketingTypeId" col-span="12"></field>
        <field field-meta-id='marketing-cost' field-meta-deleted='true' field-meta-const='true' type="currency" field-label="预计成本" v-model="marketing.predictCost" :showUnit="true" :unit="unit" col-span="24"></field>
        <field field-meta-id='marketing-name' type="string" field-label="活动主题lalala" field-prop="name" v-model="marketing.name" :disabled="disabledName" col-span="12"></field>
            <field field-meta-id='marketing-position' type="location" field-label="定位"  ref="locationRef" :lazyInit="true" v-model="newLocation" style="width:100%;" v-bind:on-change="setLocation" placeholder="请输入写字楼、街道、公司名称" col-span="24"></field>
        </bForm>
      <Button v-bind:click="click">清空选择</Button>
      <Select v-model="model1" style="width:200px">
        <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option>
    </Select>
        <bForm ref="form" bill-root-name="name2" :model="marketing" label-position="right" :rules="ruleValidate" :label-width="110" >
        <field field-meta-id='marketing-cost' type="currency" field-label="预计成本" field-meta-deleted='true' v-model="marketing.predictCost" :showUnit="true" :unit="unit" col-span="12"></field>
        <field field-meta-id='marketing-date'  field-label="开始日期" field-prop="startTime" :field-disabled="dateValidateDisabled" style="width:100%" type="date" placeholder="点击选择日期" v-model="marketing.startTime" :options="optionsStartDate" col-span="12"></field>
        <field field-meta-id='marketing-name' type="string" field-label="活动主题" field-prop="name" v-model="marketing.name" :disabled="disabledName" col-span="12"></field>
        </bForm>
  </div>
`
import mergeTool from '../../abrazos-view-designer/tools/merge-tool';
const util = {
    wrap: function(shellComponent,id, callback){
        // //get extend info from server
        // shellComponent.render = null;
        // // BaseComponent.template = '<Form :model="model" :rules="ruleValidate"><Form-item label="类型" prop="name"><Input v-model="model.name"></Input></h3></Form-item></Form>';
        // shellComponent.template = shellComponent.template.replace('</div>', '<span>动态加进去的</span></div>')
        // // debugger;
        // callback(shellComponent);

        var newInstence = Object.assign({}, shellComponent);
        mergeTool.merge(shellComponent.template, template, function(newTemplate){
            newInstence.render = null;
            newInstence.template = newTemplate;
            callback(newInstence);
        });
    }
}

export default util;